home *** CD-ROM | disk | FTP | other *** search
/ PC Action 1999 September / PC Action Issue 81 (September 1999).ISO / vft / _setup.1 / BasicVR.cst / 00003_Main Movie Script.ls < prev    next >
Encoding:
Text File  |  1997-03-03  |  2.7 KB  |  86 lines

  1. -- Main Movie Scripts
  2. --
  3. -- For basic QTVR use this castmember includes most of the scripts you need
  4. -- Not included are the calls to the "openQTVRMovie" handler and
  5. -- a frame script to display the movie and allow the user to interact with 
  6. -- it (see "Movie Display Frame Script").
  7. --------------------------------------------------------------------------
  8.  
  9. --=============================================================
  10. -- StartMovie
  11. -- 
  12. -- Sets up things for QTVR. You only want to do this once,
  13. -- so if you've got multiple Director movies in your project
  14. -- put these calls in some kind of initialization handler.
  15. ---------------------------------------------------------------
  16. on StartMovie
  17.   global gQTVRObj
  18.   
  19.   -- register the Quicktime VR component
  20.   QTVREnter(xtra "QTVRXtra")
  21.   
  22.   -- create a new instance of the xtra
  23.   set gQTVRObj = new(xtra "QTVRXtra")
  24. end
  25.  
  26. --=============================================================
  27. -- StopMovie
  28. --
  29. -- This is important: be sure to close your movies when you stop.
  30. -- Otherwise they hang out taking up ram, even though you don't see them.
  31. -- This can be a real problem when in authoring mode, as you start and stop
  32. -- the movie over and over. When in doubt call QTVRClose from the message window.
  33. ---------------------------------------------------------------
  34. on StopMovie
  35.   global gQTVRObj
  36.   
  37.   -- Close any open QTVR movies
  38.   QTVRClose(gQTVRObj)
  39.   
  40.   -- unregister the Quicktime VR component
  41.   QTVRExit(xtra "QTVRXtra")
  42. end
  43.  
  44. --=============================================================
  45. -- openQTVRMovie
  46. --
  47. -- Opens a pano or object movie.
  48. -- pMovieName is a full pathname to the movie (paltform-specific)
  49. -- pSprite is a sprite placholder with the size and location you want
  50. -- for your qtvr movie.
  51. --
  52. -- Note: This handler has no error checking. For an example handler with
  53. -- error checking, see the openMovie handler in the Testbed.
  54. ---------------------------------------------------------------
  55. on openQTVRMovie pMovieName, pSprite
  56.   global gQTVRObj
  57.   
  58.   -- Close any open QTVR movies
  59.   QTVRClose(gQTVRObj)
  60.   
  61.   -- rectToStr is a handler below
  62.   set tRect = rectToStr(the rect of sprite pSprite)
  63.   
  64.   put QTVROpen(gQTVRObj, pMovieName, tRect, "visible")
  65. end
  66.  
  67.  
  68. --=============================================================
  69. -- utilities
  70. --
  71. -- these handlers convert Lingo's rect and point variable types
  72. -- to strings for use by the xtra 
  73. ---------------------------------------------------------------
  74. on rectToStr myRect
  75.   set myString = string(myRect)
  76.   delete char 1 to 5 of myString
  77.   delete char (the length of myString) of myString
  78.   return myString
  79. end
  80.  
  81. on pointToStr myPoint
  82.   set myString = string(myPoint)
  83.   delete char 1 to 6 of myString
  84.   delete char (the length of myString) of myString
  85.   return myString
  86. end